package com.elesyser.alarm;

import com.elesyser.R;
import com.elesyser.main.CurriculumActivity;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Vibrator;
import android.util.Log;
import android.widget.Toast;

public class AlarmReceiver extends BroadcastReceiver {

	Vibrator vibrator;
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub
		NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
		try {
			Notification notification = new Notification(R.drawable.icon, intent.getStringExtra("message"), System.currentTimeMillis());

			PendingIntent pIntent = PendingIntent.getActivity(context, 0, new Intent(context, CurriculumActivity.class), 0);
			notification.setLatestEventInfo(context, "Hi", "Hello", pIntent);
			notificationManager.notify(1, notification);	
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			Log.d("notify", e.getMessage());
		}


		Toast.makeText(context, intent.getStringExtra("message"), Toast.LENGTH_LONG).show();
	}

}
